package io.kiki.stack.netty.config;

import io.kiki.stack.netty.channelManager.ChannelSelectStrategy;

/**
 * Supported options both in client and server side.
 */
public class GenericOption<T> extends Option<T> {

    /*------------ NETTY Config Start ------------*/
    public static final Option<Boolean> tcp_nodelay = valueOf("tcp.nodelay", true);
    public static final Option<Boolean> tcp_so_reuseaddr = valueOf("tcp.so.reuseaddr", true);
    public static final Option<Boolean> tcp_so_keepalive = valueOf("tcp.so.keepalive", true);

    public static final Option<Integer> tcp_so_sndbuf = valueOf("tcp.so.sndbuf");

    public static final Option<Integer> tcp_so_rcvbuf = valueOf("tcp.so.rcvbuf");

    public static final Option<Integer> netty_io_ratio = valueOf("netty.io.ratio", 70);
    public static final Option<Boolean> netty_buffer_pooled = valueOf("netty.buffer.pooled", true);

    public static final Option<Integer> netty_buffer_high_water_mark = valueOf("netty.buffer.high.watermark", 64 * 1024);
    public static final Option<Integer> netty_buffer_low_water_mark = valueOf("netty.buffer.low.watermark", 32 * 1024);

    public static final Option<Boolean> netty_epoll_switch = valueOf("netty.epoll.switch", true);

    public static final Option<Boolean> tcp_idle_switch = valueOf("tcp.heartbeat.switch", true);
    /*------------ NETTY Config End ------------*/

    /*------------ Thread Pool Config Start ------------*/
    public static final Option<Integer> tp_min_size = valueOf("tp.min", 20);
    public static final Option<Integer> tp_max_size = valueOf("tp.max", 400);
    public static final Option<Integer> tp_queue_size = valueOf("tp.queue", 600);
    public static final Option<Integer> tp_keepalive_time = valueOf("tp.keepalive", 60);

    /*------------ Thread Pool Config End ------------*/

    public static final Option<ChannelSelectStrategy> channel_select_strategy = valueOf("channel_SELECT_STRATEGY");

    public static final Option<Boolean> netty_flush_consolidation = valueOf("netty.flush_consolidation", false);

    public static final Option<ExtendedChannelHandlerList> extended_netty_channel_handler = valueOf("extend.netty.channel.handler", null);

    protected GenericOption(String name, T defaultValue) {
        super(name, defaultValue);
    }
}
